package com.sunny.gateway.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthResult {

	private Integer code;


	private String message;

	private PigUser pigUser;

	/**
	 * 扩展用户信息类，继承自User并实现OAuth2AuthenticatedPrincipal接口
	 *
	 * @author sunny
	 * @date 2025/05/31
	 */
	@Data
	public static class PigUser  implements Serializable {



		/**
		 * 扩展属性，方便存放oauth 上下文相关信息
		 */
		private final Map<String, Object> attributes = new HashMap<>();

		/**
		 * 用户ID
		 */
		@Getter

		private  Long id;

		/**
		 * 部门ID
		 */
		@Getter

		private  Long deptId;

		/**
		 * 手机号
		 */
		@Getter
		private  String phone;


		private String username;


		private String enabled;

		private List<Authority> authorities = new ArrayList<>();

		@Data
		public static class Authority{
			private String authority;
		}

		public PigUser(Long id, Long deptId, String phone, String username, String enabled,List<Authority>  authorities) {
			this.id = id;
			this.deptId = deptId;
			this.phone = phone;
			this.username = username;
			this.enabled = enabled;
			this.authorities =authorities;
		}
	}

}
